const app = getApp()

Page({

    /**
     * 页面的初始数据
     */
    data: {
        theme: app.globalData.theme, //全局颜色变量
        CustomBar: app.globalData.CustomBar,
        orderInfo: {},
        orderId: ''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var that = this;
        that.data.orderId = options.orderId;
        app.initPage().then(function (res) {
            that.orderGet();
        });
    },

    orderGet() {
        var that = this;
        app.api.orderGet(that.data.orderId).then(function (res) {
            var orderInfo = res.data;
            if (!orderInfo) {
                wx.redirectTo({url: '/pages/order/order-list/index'});
            }
            that.setData({
                orderInfo: orderInfo
            });
        });
    }
})